home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / regist2a / regaid.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-04-26  |  13.9 KB  |  422 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Begin VB.Form RegAid 
  4.    Caption         =   "RegArbiter"
  5.    ClientHeight    =   8340
  6.    ClientLeft      =   165
  7.    ClientTop       =   450
  8.    ClientWidth     =   9720
  9.    Icon            =   "RegAid.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8340
  12.    ScaleWidth      =   9720
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton cmdDelete 
  15.       Caption         =   "Delete"
  16.       Height          =   495
  17.       Left            =   3840
  18.       TabIndex        =   20
  19.       ToolTipText     =   "Unregister selected FOUND files with REGSVR32 /u"
  20.       Top             =   2280
  21.       Width           =   1095
  22.    End
  23.    Begin VB.Frame Frame1 
  24.       Caption         =   "Registry"
  25.       Height          =   3495
  26.       Left            =   7680
  27.       TabIndex        =   18
  28.       Top             =   120
  29.       Width           =   1815
  30.       Begin VB.CommandButton cmdDeleteRegKey 
  31.          Caption         =   "Delete"
  32.          Height          =   495
  33.          Left            =   360
  34.          TabIndex        =   22
  35.          Top             =   2280
  36.          Width           =   975
  37.       End
  38.       Begin VB.CommandButton cmdEditSearch 
  39.          Caption         =   "Search Exp"
  40.          Height          =   495
  41.          Left            =   360
  42.          TabIndex        =   21
  43.          Top             =   1440
  44.          Width           =   975
  45.       End
  46.       Begin VB.CommandButton cmdCheckUp 
  47.          Caption         =   "Check-Up"
  48.          Height          =   495
  49.          Left            =   360
  50.          TabIndex        =   19
  51.          ToolTipText     =   "Interrogate registry for anomalies."
  52.          Top             =   600
  53.          Width           =   975
  54.       End
  55.    End
  56.    Begin VB.CommandButton cmdDeSelAll 
  57.       Caption         =   "Deselect All"
  58.       Height          =   375
  59.       Left            =   1920
  60.       TabIndex        =   17
  61.       ToolTipText     =   "Set any selected files in list box to unselected."
  62.       Top             =   7440
  63.       Width           =   1215
  64.    End
  65.    Begin VB.CommandButton cmdSelAll 
  66.       Caption         =   "Select All"
  67.       Height          =   375
  68.       Left            =   480
  69.       TabIndex        =   16
  70.       ToolTipText     =   "Select all files in list box."
  71.       Top             =   7440
  72.       Width           =   1215
  73.    End
  74.    Begin VB.Frame fraFilters 
  75.       Caption         =   "Filters"
  76.       Height          =   3495
  77.       Left            =   5400
  78.       TabIndex        =   7
  79.       Top             =   120
  80.       Width           =   2055
  81.       Begin VB.TextBox txtFilter 
  82.          Height          =   375
  83.          Left            =   240
  84.          TabIndex        =   11
  85.          Top             =   2400
  86.          Width           =   1575
  87.       End
  88.       Begin VB.CommandButton cmdDeleteFilter 
  89.          Caption         =   "Delete"
  90.          Height          =   375
  91.          Left            =   1080
  92.          TabIndex        =   10
  93.          Top             =   2880
  94.          Width           =   735
  95.       End
  96.       Begin VB.CommandButton cmdAddFilter 
  97.          Caption         =   "Add"
  98.          Height          =   375
  99.          Left            =   240
  100.          TabIndex        =   9
  101.          Top             =   2880
  102.          Width           =   735
  103.       End
  104.       Begin VB.ListBox lstFilters 
  105.          Height          =   1620
  106.          Left            =   240
  107.          TabIndex        =   8
  108.          Top             =   360
  109.          Width           =   1575
  110.       End
  111.       Begin VB.Label Label1 
  112.          Caption         =   "New Filter:"
  113.          Height          =   255
  114.          Left            =   240
  115.          TabIndex        =   12
  116.          Top             =   2160
  117.          Width           =   975
  118.       End
  119.    End
  120.    Begin ComctlLib.StatusBar sbrStatus 
  121.       Align           =   2  'Align Bottom
  122.       Height          =   375
  123.       Left            =   0
  124.       TabIndex        =   6
  125.       Top             =   7965
  126.       Width           =   9720
  127.       _ExtentX        =   17145
  128.       _ExtentY        =   661
  129.       Style           =   1
  130.       SimpleText      =   ""
  131.       _Version        =   327682
  132.       BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
  133.          NumPanels       =   1
  134.          BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  135.             Key             =   ""
  136.             Object.Tag             =   ""
  137.          EndProperty
  138.       EndProperty
  139.    End
  140.    Begin VB.ListBox lstFiles 
  141.       Height          =   2790
  142.       Left            =   480
  143.       MultiSelect     =   2  'Extended
  144.       TabIndex        =   4
  145.       Top             =   4560
  146.       Width           =   9015
  147.    End
  148.    Begin VB.Frame fraActions 
  149.       Caption         =   "ActiveX"
  150.       Height          =   3495
  151.       Left            =   3600
  152.       TabIndex        =   2
  153.       Top             =   120
  154.       Width           =   1575
  155.       Begin VB.CommandButton cmdUnRegister 
  156.          Caption         =   "Unregister"
  157.          Height          =   495
  158.          Left            =   240
  159.          TabIndex        =   15
  160.          ToolTipText     =   "Unregister selected FOUND files with REGSVR32 /u"
  161.          Top             =   1560
  162.          Width           =   1095
  163.       End
  164.       Begin VB.CommandButton cmdRegister 
  165.          Caption         =   "Register"
  166.          Height          =   495
  167.          Left            =   240
  168.          TabIndex        =   14
  169.          ToolTipText     =   "Register selected FOUND files with REGSVR32."
  170.          Top             =   960
  171.          Width           =   1095
  172.       End
  173.       Begin VB.CheckBox chkRecurse 
  174.          Caption         =   "Recurse Directories"
  175.          Height          =   375
  176.          Left            =   240
  177.          TabIndex        =   5
  178.          ToolTipText     =   "Toggles recursion in search."
  179.          Top             =   2880
  180.          Width           =   1095
  181.       End
  182.       Begin VB.CommandButton cmdFind 
  183.          Caption         =   "&Find Files"
  184.          Height          =   495
  185.          Left            =   240
  186.          TabIndex        =   3
  187.          ToolTipText     =   "Search 'Filespec' for files matching filters."
  188.          Top             =   360
  189.          Width           =   1095
  190.       End
  191.    End
  192.    Begin VB.DirListBox dirStart 
  193.       Height          =   2790
  194.       Left            =   480
  195.       TabIndex        =   1
  196.       Top             =   840
  197.       Width           =   2775
  198.    End
  199.    Begin VB.DriveListBox drvStart 
  200.       Height          =   315
  201.       Left            =   480
  202.       TabIndex        =   0
  203.       Top             =   360
  204.       Width           =   2775
  205.    End
  206.    Begin VB.Label Label3 
  207.       Caption         =   "Registry Search Criteria:"
  208.       Height          =   375
  209.       Left            =   600
  210.       TabIndex        =   24
  211.       Top             =   3840
  212.       Width           =   1335
  213.    End
  214.    Begin VB.Label lblSearchExp 
  215.       BorderStyle     =   1  'Fixed Single
  216.       Height          =   255
  217.       Left            =   2160
  218.       TabIndex        =   23
  219.       Top             =   3960
  220.       Width           =   7215
  221.    End
  222.    Begin VB.Label Label2 
  223.       Caption         =   "Search Filespec:"
  224.       Height          =   255
  225.       Left            =   480
  226.       TabIndex        =   13
  227.       Top             =   120
  228.       Width           =   2415
  229.    End
  230. Attribute VB_Name = "RegAid"
  231. Attribute VB_GlobalNameSpace = False
  232. Attribute VB_Creatable = False
  233. Attribute VB_PredeclaredId = True
  234. Attribute VB_Exposed = False
  235. Option Explicit
  236. '   $Revision: 2 $
  237. '   $Log: /RegAid/RegAid.frm $
  238. '2     4/27/99 9:03a Willib
  239. 'Testing Keyword Expansion 1
  240. '  1     4/27/99 8:56a Willib
  241. '  Initial Check-In
  242. Private Sub cmdAddFilter_Click()
  243. Dim intFilterCount As Integer
  244.     For intFilterCount = 0 To lstFilters.ListCount - 1
  245.         If ("*." & txtFilter) = lstFilters.List(intFilterCount) Then
  246.             MsgBox "Duplicate filters not allowed."
  247.             txtFilter = ""
  248.             Exit Sub
  249.         End If
  250.     Next intFilterCount
  251.     If InStr(txtFilter, "*") Or InStr(txtFilter, ".") Then
  252.         MsgBox "Characters * and . not allowed. Enter just the extension, e.g. OCX or DLL."
  253.         txtFilter = ""
  254.         Exit Sub
  255.     End If
  256.     lstFilters.AddItem "*." & Trim$(txtFilter)
  257.     txtFilter = ""
  258. End Sub
  259. Private Sub cmdCheckUp_Click()
  260. Dim blnFound As Boolean
  261. Dim i As Long
  262.     Screen.MousePointer = vbHourglass
  263.     Call RegFind(lblSearchExp, FIND_KEY, blnFound)
  264.     lstFiles.Clear
  265.     If blnFound Then
  266.         For i = 0 To udtResults.lngEntryCount - 1
  267.             lstFiles.AddItem udtResults.varEntryList(i)
  268.         Next i
  269.     Else
  270.         lstFiles.AddItem "No registry items found for search criteria."
  271.     End If
  272.     Screen.MousePointer = vbNormal
  273. End Sub
  274. Private Sub cmdDelete_Click()
  275. On Error GoTo cmdDelete_Click_Error
  276. Dim iCount As Integer
  277.     If lstFiles.SelCount > 0 Then
  278.         For iCount = 0 To lstFiles.ListCount - 1
  279.             If lstFiles.Selected(iCount) = True Then
  280.                 Kill lstFiles.List(iCount)
  281.             End If
  282.         Next iCount
  283.         For iCount = lstFiles.ListCount - 1 To 0 Step -1
  284.             If lstFiles.Selected(iCount) = True Then
  285.                 lstFiles.RemoveItem (iCount)
  286.             End If
  287.         Next
  288.     Else
  289.         MsgBox "You must select files to delete."
  290.     End If
  291. Exit Sub
  292. cmdDelete_Click_Error:
  293.     Select Case Err.Number
  294.         Case 75
  295.             MsgBox "Error '75' : Check the files for read-only attribute."
  296.         Case Else
  297.             MsgBox "Error '" & Str(Err.Number) & "' : Error Deleting files."
  298.     End Select
  299. End Sub
  300. Private Sub cmdDeleteFilter_Click()
  301. Dim lngResult As Long
  302. Dim intListPointer As Integer
  303.     If lstFilters.ListCount = 1 Then
  304.         lngResult = MsgBox("You will not be able to run Find without at least one filter; Delete anyway?", vbYesNo + vbInformation, "RegArbiter")
  305.         If lngResult = vbNo Then
  306.             Exit Sub
  307.         End If
  308.     End If
  309.     lstFilters.RemoveItem lstFilters.ListIndex
  310.     cmdDeleteFilter.Enabled = False
  311. End Sub
  312. Private Sub cmdDeSelAll_Click()
  313.     Dim iCount As Integer
  314.     If lstFiles.ListCount > 0 Then
  315.         For iCount = 0 To lstFiles.ListCount - 1
  316.             lstFiles.Selected(iCount) = False
  317.         Next iCount
  318.     End If
  319. End Sub
  320. Private Sub cmdEditSearch_Click()
  321. Dim strSearchExp As String
  322.     strSearchExp = InputBox("Search Registry for this string", "Search Criteria")
  323.     lblSearchExp = strSearchExp
  324. End Sub
  325. Private Sub cmdFind_Click()
  326. Dim blnCheckOn As Boolean
  327. Dim intFilterCount As Integer
  328. Dim intFilterMax As Integer
  329. Dim strPath As String
  330.     Screen.MousePointer = vbHourglass
  331.     intFilterMax = lstFilters.ListCount
  332.     If intFilterMax = 0 Then
  333.         MsgBox "You must have at least one filter."
  334.         Exit Sub
  335.     End If
  336.     blnCheckOn = IIf(chkRecurse.Value = 0, False, True)
  337.     Erase g_strFiles
  338.     ReDim g_strFiles(0)
  339.     If Right$(dirStart.Path, 1) = "\" Then
  340.         strPath = Left$(dirStart.Path, Len(dirStart.Path) - 1)
  341.     Else
  342.         strPath = dirStart.Path
  343.     End If
  344.     For intFilterCount = 0 To intFilterMax - 1
  345.         Call FindFiles(blnCheckOn, strPath, lstFilters.List(intFilterCount))
  346.     Next intFilterCount
  347.     Call ListFiles(lstFiles)
  348.     Screen.MousePointer = vbNormal
  349. End Sub
  350. Private Sub cmdRegister_Click()
  351. Dim iCount As Integer
  352. Dim lngResult As Long
  353.     If lstFiles.SelCount > 0 Then
  354.         For iCount = 0 To lstFiles.ListCount - 1
  355.             If lstFiles.Selected(iCount) = True Then
  356.                 If (Right$(lstFiles.List(iCount), 3) = "OCX") _
  357.                 Or (Right$(lstFiles.List(iCount), 3) = "DLL") Then
  358.                     lngResult = Shell("regsvr32 " & Chr(34) & lstFiles.List(iCount) & Chr(34), vbNormalNoFocus)
  359.                 End If
  360.             End If
  361.         Next iCount
  362.     Else
  363.         MsgBox "You must select files to register."
  364.     End If
  365. End Sub
  366. Private Sub cmdSelAll_Click()
  367. Dim iCount As Integer
  368.     If lstFiles.ListCount > 0 Then
  369.         For iCount = 0 To lstFiles.ListCount - 1
  370.             lstFiles.Selected(iCount) = True
  371.         Next iCount
  372.     End If
  373. End Sub
  374. Private Sub cmdUnRegister_Click()
  375. Dim iCount As Integer
  376. Dim lngResult As Long
  377.     If lstFiles.SelCount > 0 Then
  378.         For iCount = 0 To lstFiles.ListCount - 1
  379.             If lstFiles.Selected(iCount) = True Then
  380.                 If (Right$(lstFiles.List(iCount), 3) = "OCX") _
  381.                 Or (Right$(lstFiles.List(iCount), 3) = "DLL") Then
  382.                     'lngResult = Shell("regsvr32 " & Chr(34) & lstFiles.List(iCount) & Chr(34) & " > " & App.Path & "\output.txt", vbNormalNoFocus)
  383.                     lngResult = Shell("regsvr32 -u " & Chr(34) & lstFiles.List(iCount) & Chr(34), vbNormalNoFocus)
  384.                 End If
  385.             End If
  386.         Next iCount
  387.     Else
  388.         MsgBox "You must select files to unregister."
  389.     End If
  390. End Sub
  391. Private Sub drvStart_Change()
  392.     'Keep the directory control in sync
  393.     dirStart.Path = drvStart.Drive
  394. End Sub
  395. Private Sub Form_Load()
  396.     'The beginning path for the controls
  397.     dirStart.Path = drvStart.Drive
  398.     Call PopulateFilter(lstFilters)
  399.     cmdAddFilter.Enabled = False
  400.     cmdDeleteFilter.Enabled = False
  401.     'Center the form
  402.     Center Me
  403. End Sub
  404. Private Sub lstFilters_Click()
  405.     If lstFilters.ListIndex <> -1 Then
  406.         cmdDeleteFilter.Enabled = True
  407.     Else
  408.         cmdDeleteFilter.Enabled = False
  409.     End If
  410. End Sub
  411. Private Sub txtFilter_Change()
  412.     If Len(txtFilter) = 0 Then
  413.         cmdAddFilter.Enabled = False
  414.     Else
  415.         
  416.         cmdAddFilter.Enabled = True
  417.     End If
  418. End Sub
  419. Private Sub txtFilter_LostFocus()
  420.     txtFilter = UCase$(txtFilter)
  421. End Sub
  422.